#include "configs.h"

/********Core define*********/
Core_Step core_step = CORE_PARAM_WAIT_INIT;
uint16_t Main_time_ms_cnt;

void reset_dart(void){
	__disable_irq();
	NVIC_SystemReset();
}
/********Core define*********/

/********Led define*********/
Led_config led_config = {
    .led_left_state = LED_FLASHING,
    .led_left_init_state = true,
    .led_left_freq = 2,
    .led_left_toggle_time = 500,

    .led_right_state = LED_FLASHING,
    .led_right_init_state = false,
    .led_right_freq = 2,
    .led_right_toggle_time = 500,
};

/********Led define*********/



/******Log File System*****/
uint16_t now_normal_log_id = 1;
uint16_t now_flight_log_id = 2;
/******Log File System*****/

/*****Imu define**********/
Imu_driver_t imu2 = {
	.imu_id = 2,
	.hspi_use = &hspi2,
	.CS_PORT = GYRO_CS2_GPIO_Port,
	.CS_PIN = GYRO_CS2_Pin,
	.imu_state = FIND_IMU,
	.imu_online_if = false,
	.fifo_ready = false,
	.gyro_max = GYRO_CONFIG0_FS_SEL_2000,
	.gyro_dps = 0,
	.accel_max = ACCEL_CONFIG0_FS_SEL_16G,
	.accel_dps = 0,
	.update_offset = false,
	.max_offset_data_get = MAX_OFFSET_DATA_CNT,
	.now_offset_data_get = 0,
	.get_gyro_x_data = 0.0f,
	.get_gyro_y_data = 0.0f,
	.get_gyro_z_data = 0.0f,
	.get_accel_x_data = 0.0f,
	.get_accel_y_data = 0.0f,
	.get_accel_z_data = 0.0f,
	.accel_x_offset = 0.0f,
	.accel_y_offset = 0.0f,
	.accel_z_offset = 0.0f,
	.gyro_x_offset = 0.0f,
	.gyro_y_offset = 0.0f,
	.gyro_z_offset = 0.0f
};

Imu_driver_t imu1 = {
	.imu_id = 1,
	.hspi_use = &hspi1,
	.CS_PORT = GYRO_CS1_GPIO_Port,
	.CS_PIN = GYRO_CS1_Pin,
	.imu_state = FIND_IMU,
	.imu_online_if = false,
	.fifo_ready = false,
	.gyro_max = GYRO_CONFIG0_FS_SEL_2000,
	.gyro_dps = 0,
	.accel_max = ACCEL_CONFIG0_FS_SEL_16G,
	.accel_dps = 0,
	.update_offset = false,
	.max_offset_data_get = MAX_OFFSET_DATA_CNT,
	.now_offset_data_get = 0,
	.get_gyro_x_data = 0.0f,
	.get_gyro_y_data = 0.0f,
	.get_gyro_z_data = 0.0f,
	.get_accel_x_data = 0.0f,
	.get_accel_y_data = 0.0f,
	.get_accel_z_data = 0.0f,
	.accel_x_offset = 0.0f,
	.accel_y_offset = 0.0f,
	.accel_z_offset = 0.0f,
	.gyro_x_offset = 0.0f,
	.gyro_y_offset = 0.0f,
	.gyro_z_offset = 0.0f
};

Dart_attitude dart_attitude = {
	.accels = {0.0f},
	.gyros = {0.0f},
	.ahrs_init = false,
	.imu_state = {false},
	.imu_num = 0
};
/*****Imu define**********/

/*****Usart define*********/
Usart_handle huart1_usart_handle;
/*****Usart define*********/

